package com.md.mapper;


import com.md.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {

    @Select("select * from student")
    List<Student> getStudents() ;

    @Select("select * from student where studentName like '%${studentName}%'")
    List<Student> getStudentByName(String studentName) ;

    @Select("select * from student where studentId = #{id}")
    Student getStudentById(int id) ;

    @Delete("delete from student where studentId = #{id}")
    int DelStudentById(int id) ;

    @Insert("insert into student (studentName, classname, classTeacher) VALUES (#{studentName},#{className},#{classTeacher})")
    int insertStudent(Student student) ;

    @Update("update student set studentName = #{studentName}, classname = #{className}, classTeacher = #{classTeacher} where studentId = #{studentId}")
    int updateStudent(Student student) ;

}
